package com.ccit.springbootlaw.pojo;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "laws") // 显式指定表名
// 法律信息表
// id (主键)
// title (法律标题)
// content (法律内容)
// category (法律类别)
// lawtime (法律时间)
// timeliness (法律时效性)
// lawauthor (法律颁布部门)
// created_at (创建时间)
// updated_at (更新时间)
public class Law {
    private int id;
    private String title;
    private String content;
    private String category;
    private Date lawtime;
    private String timeliness;
    private String lawauthor;
    private Timestamp created_at;
    private Timestamp updated_at;

    @Id
    @Column(name = "id")
    // id (主键)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "title")
    // title (法律标题)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic
    @Column(name = "content")
    // content (法律内容)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Basic
    @Column(name = "category")
    // category (法律类别)
    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    @Basic
    @Column(name = "lawtime")
    // lawtime (法律时间)
    public Date getLawtime() {
        return lawtime;
    }

    public void setLawtime(Date lawtime) {
        this.lawtime = lawtime;
    }

    @Basic
    @Column(name = "timeliness")
    // timeliness (法律时效性)
    public String getTimeliness() {
        return timeliness;
    }

    public void setTimeliness(String timeliness) {
        this.timeliness = timeliness;
    }

    @Basic
    @Column(name = "lawauthor")
    // lawauthor (法律作者)
    public String getLawauthor() {
        return lawauthor;
    }

    public void setLawauthor(String lawauthor) {
        this.lawauthor = lawauthor;
    }

    @Basic
    @Column(name = "created_at")
    // created_at (创建时间)
    public Timestamp getCreatedAt() {
        return created_at;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.created_at = createdAt;
    }

    @Basic
    @Column(name = "updated_at")
    // updated_at (更新时间)
    public Timestamp getUpdatedAt() {
        return updated_at;
    }

    public void setUpdatedAt(Timestamp updatedAt) {
        this.updated_at = updatedAt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Law laws = (Law) o;
        return id == laws.id && Objects.equals(title, laws.title) && Objects.equals(content, laws.content) && Objects.equals(category, laws.category) && Objects.equals(lawtime, laws.lawtime) && Objects.equals(timeliness, laws.timeliness) && Objects.equals(lawauthor, laws.lawauthor) && Objects.equals(created_at, laws.created_at) && Objects.equals(updated_at, laws.updated_at);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, title, content, category, lawtime, timeliness, lawauthor, created_at, updated_at);
    }
}